package com.blrs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.blrs.service.honor.IHonerManagementAttachmentService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.blrs.common.annotation.Log;
import com.blrs.common.core.controller.BaseController;
import com.blrs.common.core.domain.AjaxResult;
import com.blrs.common.enums.BusinessType;
import com.blrs.domain.HonerManagementAttachment;
import com.blrs.common.utils.poi.ExcelUtil;
import com.blrs.common.core.page.TableDataInfo;

/**
 * 荣誉资质附件Controller
 * 
 * @author ruoyi
 * @date 2023-07-19
 */
@RestController
@RequestMapping("/Honer/attachment")
public class HonerManagementAttachmentController extends BaseController
 {
    @Autowired
    private IHonerManagementAttachmentService honerManagementAttachmentService;

    /**
     * 查询荣誉资质附件列表
     */
    //@PreAuthorize("@ss.hasPermi('Honer:attachment:list')")
    @GetMapping("/list")
    public TableDataInfo list(HonerManagementAttachment honerManagementAttachment)
    {
        startPage();
        List<HonerManagementAttachment> list = honerManagementAttachmentService.selectHonerManagementAttachmentList(honerManagementAttachment);
        return getDataTable(list);
    }

    /**
     * 导出荣誉资质附件列表
     */
    //@PreAuthorize("@ss.hasPermi('Honer:attachment:export')")
    @Log(title = "荣誉资质附件", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HonerManagementAttachment honerManagementAttachment)
    {
        List<HonerManagementAttachment> list = honerManagementAttachmentService.selectHonerManagementAttachmentList(honerManagementAttachment);
        ExcelUtil<HonerManagementAttachment> util = new ExcelUtil<HonerManagementAttachment>(HonerManagementAttachment.class);
        util.exportExcel(response, list, "荣誉资质附件数据");
    }

    /**
     * 获取荣誉资质附件详细信息
     */
    //@PreAuthorize("@ss.hasPermi('Honer:attachment:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(honerManagementAttachmentService.selectHonerManagementAttachmentById(id));
    }

    /**
     * 新增荣誉资质附件
     */
    //@PreAuthorize("@ss.hasPermi('Honer:attachment:add')")
    @Log(title = "荣誉资质附件", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HonerManagementAttachment honerManagementAttachment)
    {
        return toAjax(honerManagementAttachmentService.insertHonerManagementAttachment(honerManagementAttachment));
    }

    /**
     * 修改荣誉资质附件
     */
    //@PreAuthorize("@ss.hasPermi('Honer:attachment:edit')")
    @Log(title = "荣誉资质附件", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HonerManagementAttachment honerManagementAttachment)
    {
        return toAjax(honerManagementAttachmentService.updateHonerManagementAttachment(honerManagementAttachment));
    }

    /**
     * 删除荣誉资质附件
     */
    //@PreAuthorize("@ss.hasPermi('Honer:attachment:remove')")
    @Log(title = "荣誉资质附件", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(honerManagementAttachmentService.deleteHonerManagementAttachmentByIds(ids));
    }
}
